# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=libdatachannel
pkgver=0.21.2
pkgrel=0
pkgdesc="C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets"
url="https://libdatachannel.org"
arch="all"
license="MPL-2.0"
makedepends="
	cmake
	libnice-dev
	libusrsctp-dev 
	libsrtp-dev
	nlohmann-json
	openssl-dev
	plog-dev
	samurai"

subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/paullouisageneau/libdatachannel/archive/refs/tags/v$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_NICE=1 \
		-DPREFER_SYSTEM_LIB=1
	cmake --build build
}

check() {
	make test
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
fd0d66bb932e29abc01e9f1a8b16ccb79012a7e3901e2e0f882f56ab2f090260945e1556c85ad07ef897b8c70fcdd44cdeead9955a9bca7afe1dda8900c473cc  libdatachannel-0.21.2.tar.gz
"
